from crawler.settings import start_process, get_crawler_process

from .yoox import *
from .matchesfashion import *
from .mrporter import *
from .porter import *
from .ssense import *
from .selfridges import *
from .theoutnet import *
from .zappos import *
from .lv import *

yoox_list = [
    (YooxMainSpider, 1)
]

matchesfashion_list = [
    (MatchesFashionMainSpider, 1)
]
mrproter_list = [
    (MrporterMainSpider, 1)
]

porter_list = [
    (PorterMainSpider, 1)
]
ssense_list = [
    (SsenseMainSpider, 1)
]
selfridges_list = [
    (SelfRidgesMainSpider, 1)
]

theoutnet_list = [
    (TheoutnetMainSpider, 1)
]
zappos_list = [
    (ZapposMainSpider, 1)
]
lv_list = [
    (LouMainSpider, 1)
]
total_list = [
    (ZapposMainSpider, 1),
    (TheoutnetMainSpider, 1),
    (SelfRidgesMainSpider, 1),
    (SsenseMainSpider, 1),
    (PorterMainSpider, 1),
    (MrporterMainSpider, 1),
    (MatchesFashionMainSpider, 1),
    (YooxMainSpider, 1)
]


def run_total():
    start_process(total_list)


# #
# def run_yoox():
#     process = get_crawler_process()
#     for spider in yoox_spider:
#         process.crawl(spider)
#     process.start(False)


def run_yoox():
    process = get_crawler_process()
    for spider in yoox_spider:
        process.crawl(spider)
    process.start(False)


def run_matchesfashion():
    process = get_crawler_process()
    for spider in matchesfashion_spider:
        process.crawl(spider)
    process.start(False)


def run_mrporter():
    process = get_crawler_process()
    for spider in mrproter_spider:
        process.crawl(spider)
    process.start(False)


def run_porter():
    process = get_crawler_process()
    for spider in porter_spider:
        process.crawl(spider)
    process.start(False)


def run_ssense():
    process = get_crawler_process()
    for spider in ssense_spider:
        process.crawl(spider)
    process.start(False)


def run_selfridges():
    process = get_crawler_process()
    for spider in selfridges_spider:
        process.crawl(spider)
    process.start(False)


def run_theoutnet():
    process = get_crawler_process()
    for spider in theoutnet_spider:
        process.crawl(spider)
    process.start(False)


def run_zappos():
    process = get_crawler_process()
    for spider in zappos_spider:
        process.crawl(spider)
    process.start(False)


def run_lv():
    process = get_crawler_process()
    for spider in lv_spider:
        process.crawl(spider)
    process.start(False)


def run_test():
    process = get_crawler_process()
    for spider in ssense_spider:
        process.crawl(spider)
    process.start(False)
